package com.wen.yygh.msm.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.nio.charset.StandardCharsets;

/**
 * @author Wenjl
 */
@Component
public class ConstantPropertiesUtils implements InitializingBean {
    @Value("${txyun.sms.region}")
    private String region;
    @Value("${txyun.sms.secretId}")
    private String secretId;
    @Value("${txyun.sms.secretKey}")
    private String secretKey;
    @Value("${txyun.sms.sdkId}")
    private String sdkId;
    @Value("${txyun.sms.signName}")
    private String signName;
    @Value("${txyun.sms.templateId}")
    private String templateId;

    public static String REGION;
    public static String SECRET_ID;
    public static String SECRET_KEY;
    public static String SDK_ID;
    public static String SIGN_NAME;
    public static String TEMPLATE_ID;

    @Override
    public void afterPropertiesSet() throws Exception {
        REGION = region;
        SECRET_ID = secretId;
        SECRET_KEY = secretKey;
        SDK_ID = sdkId;
        signName = new String(new String(signName.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8));


        SIGN_NAME = signName;
        TEMPLATE_ID = templateId;
    }
}
